/**
  ******************************************************************************
  * @author     Chris
  * @since      2023/9/29 22:38
  *
  * @file       hd_ldr.c
  * @brief      LDR(Photo Resister) Hardware Driver.
  *
  * @note       This file contains the hardware driver for the LDR(Photo Resister).
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date           Author       Notes
  *   2023-09-29     Chris        the first version
  *
  ******************************************************************************
  */

#include "stm32g4xx_ll_bus.h"
#include "stm32g4xx_ll_gpio.h"
#include "pd_h_gpio.h"



/** region Declaration and Definition Region */


/** region Variables and Constants Region */

/** endregion Variables and Constants Region */


/** region Function Declaration Region */

/** endregion Function Declaration Region */


/** endregion Declaration and Definition Region */



/** region Public Definition Region */
/**
 * @brief   光敏电阻初始化
 *          这里的光敏电阻传感器两个输出：
 *              1. AO(Analog Output，模拟输出)
 *              2. DO(Digital Output，数字输出)
 * @note    无
 * @param   无
 * @retval  无
 */
void HD_LDR_Init() {
    PD_H_GPIO_LDRInit();
}

/**
 * @brief   获取光敏电阻传感器返回值
 * @note    无
 * @param   无
 * @retval  0，触发；1，未触发。
 */
uint8_t HD_LDR_Level() {
    if (PD_H_GPIO_ReadBit(GPIOA, LL_GPIO_PIN_2) != RESET) {
        return 1;
    } else {
        return 0;
    }
}

/** endregion Public Definition Region */



/** region Private Definition Region */

/** endregion  Private Definition Region  */
